package com.hkp.demo.controller;

import com.hkp.demo.entity.response.AjaxResponseWrapper;
import com.hkp.demo.service.IProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 质量专项表 前端控制器
 * </p>
 *
 * @author HuKangPing
 * @since 2023-02-22 14:20:35
 */
@RestController
@RequestMapping("/project")
@Api(tags = "专项")
@Slf4j
public class ProjectController {

    @Resource
    private IProjectService iProjectService;

    @GetMapping("/projectNums")
    @ApiOperation("查询所有专项数量")
    public AjaxResponseWrapper<Long> getProjectNum(String day) {
        try {
            Long projectNum = iProjectService.getProjectNum(day);
            return AjaxResponseWrapper.operate(true, "查询所有专项数量", projectNum);
        } catch (Exception e) {
            log.error("查询所有专项数量失败");
            e.printStackTrace();
            return AjaxResponseWrapper.fail(e);
        }
    }


}
